﻿using System.Collections.Generic;
using System;

namespace GameBasic
{
    /// <summary>
    /// Adapter for method extensions
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public struct ComparerStruct<T> : IComparer<T> where T : IComparable<T>
    {
        public int Compare(T x, T y)
        {
            return x.CompareTo(y);
        }
    }

    public struct CompareStruct<K, T> : IKeyComparer<K, T> where K : IComparable<T>
    {
        int IKeyComparer<K, T>.CompareStruct(in K key, in T item)
        {
            return key.CompareTo(item);
        }
    }
}